/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package server;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * The server for the translator application.
 * Handles the incomming connections and delegates the input for translation.
 * @author Luuk
 */
public class TranslatorServer{

    public final static int PORT = 4444;
    
    /**
     * Checks for incomming connections and fires threads to handle that connection.
     * @param args command line arguments
     */
    public static void main(String[] args){
        try {
            
            ServerSocket socket = new ServerSocket(PORT);
            while(true){
                Socket client = socket.accept();
                new Thread(new ServerThread(client)).start();
            }
        } catch (UnknownHostException ex) {
            Logger.getLogger(TranslatorServer.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(TranslatorServer.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
}
